package ch.cryptobox;

import java.util.HashSet;
import java.util.Set;

public class MessageBus {
	private final Set<String> toBeIgnoredOnce = new HashSet<String>();
	private static MessageBus instance = null;
	
	private MessageBus() {}
	
	public synchronized static MessageBus getInstance() {
		if(instance == null) {
			instance = new MessageBus();
		}
		
		return instance;
	}
	
	public synchronized void addToBeIgnoredOnce(final String path) {
		//System.out.println("ADDED " + path);
		toBeIgnoredOnce.add(path);
	}
	
	public synchronized boolean hasToToBeIgnored(final String path) {
		return toBeIgnoredOnce.remove(path);
	}
	
}
